translator.service({
  meta : {
    version : "0.0.1",
    shortName : "systran",
    name : "Systran Global Translation.",
    icon : "chrome://translator/skin/services/systran.png",
    homepage : "http://www.systran.co.uk/"
  },
  
  translate : {
    charLimit : 1000,
    method : function (options) {      
      var lp = options.srcLang + "_" + options.destLang;
      
      Mozkit.http.send({
        method : "POST",
        url : "http://systranet.com/tt?gui=www.systran.co.uk;/snetcom/text/ts&lp=" + lp + "&MAX_TRANSLATED_WORDS=500&service=translate",        
        requestBody : {"" : options.text},
        callBack : function (data) {
          var text = data.split("body=\n")[1]
          if (text) {
            options.success(text.replace("=", ""));
          } else {
            options.fail(data)
          }
        },
        error : function (error) {
          console.log(error);
          options.fail(error);
        }
      });
    }
  },
  
  langSets : {
    ENGLISH : ["FRENCH", "SPANISH", "ITALIAN", "PORTUGUESE", "GERMAN", "DUTCH", "SWEDISH", "RUSSIAN", "ARABIC", "JAPANESE", "KOREAN", "CHINESE", "POLISH", "GREEK"], FRENCH:["ENGLISH", "SPANISH", "ITALIAN", "PORTUGUESE", "GERMAN", "DUTCH", "GREEK"],
    SPANISH:["ENGLISH", "FRENCH", "ITALIAN", "PORTUGUESE", "GERMAN"],
    ITALIAN:["ENGLISH", "FRENCH", "SPANISH", "PORTUGUESE", "GERMAN"],
    PORTUGUESE:["ENGLISH", "FRENCH", "SPANISH", "ITALIAN", "GERMAN"],
    GERMAN:["ENGLISH", "FRENCH", "SPANISH", "ITALIAN", "PORTUGUESE"],
    DUTCH:["ENGLISH", "FRENCH"],
    SWEDISH:["ENGLISH"],
    RUSSIAN:["ENGLISH"],
    ARABIC:["ENGLISH"],
    JAPANESE:["ENGLISH"],
    KOREAN:["ENGLISH"],
    CHINESE:["ENGLISH"],
    POLISH:["ENGLISH"],
    GREEK:["ENGLISH", "FRENCH"]}
});